<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>通知信息管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			var moduleIds = "${notice.moduleIds}";
			moduleArr = moduleIds.split(',');
			$('input[name*="moduleIds"]').each(function(index,en){
				var enval = $(en).val();
				$(moduleArr).each(function(i,mo){
					var moval = moduleArr[i];
					if(enval==moval){
						$(en).attr("checked","checked");
					}
				})
			})
			var levelIds = "${notice.levelIds}";
			levelArr = levelIds.split(',');
			$('input[name*="levelIds"]').each(function(index,en){
				var enval = $(en).val();
				$(levelArr).each(function(i,mo){
					var moval =levelArr[i];
					if(enval==moval){
						$(en).attr("checked","checked");
					}
				})
			})
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/tsdemo/notice/notice/">通知信息列表</a></li>
		<li class="active"><a href="${ctx}/tsdemo/notice/notice/form?id=${notice.id}">通知信息<shiro:hasPermission name="tsdemo:notice:notice:edit">${not empty notice.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="tsdemo:notice:notice:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="notice" action="${ctx}/tsdemo/notice/notice/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">栏目：</label>
			<div class="controls">
                <sys:treeselect id="categoryId" name="categoryId" value="${notice.categoryId}" labelName="parent.name" labelValue="${notice.categoryName}"
					title="栏目" url="/tsdemo/notice/notice/treeData" extId="${category.id}" cssClass="required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">行业：</label>
			<div class="controls">
				<form:checkboxes path="moduleIds" items="${fns:getDictList('t_business')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">层级：</label>
			<div class="controls">
				<form:checkboxes path="levelIds" items="${fns:getDictList('t_hierarchy')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">标题：</label>
			<div class="controls">
				<form:input path="title" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">缩略图：</label>
			<div class="controls">
				<form:hidden id="image" path="image" htmlEscape="false" maxlength="255" class="input-xlarge"/>
				<sys:ckfinder input="image" type="files" uploadPath="/tsdemo/notice/notice" selectMultiple="true"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">内容：</label>
			<div class="controls">
				<form:textarea id="content" htmlEscape="true" path="content" rows="4" maxlength="200" class="input-xxlarge"/>
				<sys:ckeditor replace="content" uploadPath="/tsdemo/notice/notice" />
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">状态：</label>
			<div class="controls">
				<form:select path="status" class="input-xlarge required">
					<%-- <form:option value="" label=""/> --%>
					<form:options items="${fns:getDictList('notice_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="tsdemo:notice:notice:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>